package org.ffmpeg.ohos.test;

import java.io.File;

import ohos.app.Context;
import org.ffmpeg.ohos.Clip;
import org.ffmpeg.ohos.FfmpegController;
import org.ffmpeg.ohos.ShellUtils;
import util.Log;

public class MixTest {

	private final static String TAG = MixTest.class.getSimpleName();

	public static void test (Context ctx, String fileTmpPath, String videoClipPath, String audioClipPath, Clip clipOut) throws Exception
	{
		File fileTmp = new File(fileTmpPath);

		FfmpegController fc = new FfmpegController(ctx, fileTmp);
		
		Clip clipVideo = new Clip(videoClipPath);
		Clip clipAudio = new Clip(audioClipPath);
		
		fc.combineAudioAndVideo(clipVideo, clipAudio, clipOut, new ShellUtils.ShellCallback() {
			
			@Override
			public void shellOut(String shellLine) {
			}
			
			@Override
			public void processComplete(int exitValue) {
				if (exitValue != 0)
					Log.e(TAG, "concat non-zero exit: " + exitValue);
			}
		});
	}
}
